package com.hzw.saas.service.rbac.config;

import java.util.Objects;

import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Component;
import lombok.Data;

/**
 * @author zzl
 * @since 09/03/2021
 */
@Component
@ConfigurationProperties(prefix = "saas.rbac", ignoreInvalidFields = true, ignoreUnknownFields = true)
@Data
public class RbacConfig {

    private Boolean superAdminMode = false;

    private String superAdminId = "0000000000000000000";

    public boolean isSuperAdmin(String userId) {
        return superAdminMode && Objects.equals(userId, superAdminId);
    }
}
